package com.woniuxy;

import com.woniuxy.entity.RbacManager;
import com.woniuxy.service.RbacManagerService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

/**
 * @Author: 马宇航
 * @Todo: TODO
 * @DateTime: 22/03/28/0028 下午 3:10
 * @Component: 成都蜗牛学苑
 **/
public class ProxyFactoryBeanTest {
    public static void main(String[] args) {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
        RbacManagerService rbacManagerService = (RbacManagerService) applicationContext.getBean("rbacManagerService");
        int i = rbacManagerService.addOne(new RbacManager("mayuhang", "1234567", "y"));
        if (i>0){
            System.out.println("插入成功");
        }
//        查询方法
//        List<RbacManager> all = rbacManagerService.findAll();
//        all.forEach(System.out::println);
//        删除方法
//        int id = 27;
//        int i = rbacManagerService.deleteOne(id);
//        if (i>0){
//            System.out.println("成功删除id为"+id+"的数据");
//        }
//        更新数据
//        int i = rbacManagerService.updateOne(new RbacManager(26, "admin222", "123", "y"));
//        if (i>0){
//            System.out.println("成功更新一条数据。");
//        }

    }
}
